home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / jade-3.2.lha / jade-3.2 / man / jade.info-7 < prev    next >
Encoding:
GNU Info File  |  1994-10-16  |  49.3 KB  |  1,371 lines

  1. This is Info file jade.info, produced by Makeinfo-1.55 from the input
  2. file jade.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Jade: (jade).            An editor for X11 and AmigaDOS
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This is Edition 1.3, last updated 7 October 1994, of `The Jade
  9. Manual', for Jade, Version 3.2.
  10.  
  11.    Jade is a text editor for X11 (on Unix) and the Amiga.
  12.  
  13.    Copyright 1993, 1994 John Harper.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided that
  21. the entire resulting derived work is distributed under the terms of a
  22. permission notice identical to this one.
  23.  
  24. 
  25. File: jade.info,  Node: The Current Buffer,  Prev: The Buffer List,  Up: Buffers
  26.  
  27. The Current Buffer
  28. ------------------
  29.  
  30.    The "current buffer" is the buffer being displayed in the current
  31. window (*note Windows::.), all functions which take an optional BUFFER
  32. argument will operate on the current buffer if this argument is
  33. undefined.  Similarly if a WINDOW argument to a function is left
  34. undefined the current window will be used.
  35.  
  36.  - Function: current-buffer &optional WINDOW
  37.      Returns the buffer being displayed by the window WINDOW (or the
  38.      current window).
  39.  
  40.           (current-buffer)
  41.               => #<buffer programmer.texi>
  42.  
  43.    The `set-current-buffer' function sets the current buffer of a
  44. window.  If, when the window is next redisplayed (i.e. after each
  45. command), the current buffer is different to what it was at the last
  46. redisplay the new buffer will be displayed in the window.
  47.  
  48.  - Function: set-current-buffer BUFFER &optional WINDOW
  49.      Sets the buffer that the window is displaying.
  50.  
  51.      Usually a window's current buffer will be the buffer which is at
  52.      the head of the window's `buffer-list'. The function `goto-buffer'
  53.      can be used to set both of these at once.
  54.  
  55.  - Function: goto-buffer BUFFER
  56.      Set the current buffer to BUFFER which is either a buffer or a
  57.      string naming a buffer. The selected buffer is moved to the head
  58.      of the window's `buffer-list'.
  59.  
  60.      If BUFFER is a string and no buffer exists of that name a new one
  61.      is created.
  62.  
  63.    Often you will want to temporarily switch to a different current
  64. buffer, that is what the `with-buffer' special form is for.
  65.  
  66.  - Special Form: with-buffer BUFFER FORMS...
  67.      Temporarily sets the current buffer to the value of evaluating
  68.      BUFFER, then evaluates the FORMS in sequence. The old value of the
  69.      current buffer is reinstated and the structure returns the value
  70.      of the last of the FORMS to be evaluated.
  71.  
  72.      If the implicit progn evaluating FORMS is exited abnormally the
  73.      old value of the current buffer will still be reinstated.
  74.  
  75.      If the window is redisplayed while the FORMS are being evaluated
  76.      (i.e.  in a recursive edit) the new buffer will be drawn into the
  77.      window.
  78.  
  79.           (with-buffer new-buffer         ;Enter a recursive edit in
  80.             (recursive-edit))             ; the buffer `new-buffer'.
  81.  
  82. 
  83. File: jade.info,  Node: Windows,  Next: Positions,  Prev: Buffers,  Up: Programming Jade
  84.  
  85. Windows
  86. =======
  87.  
  88.    A "window" is a Lisp object representing a window (a rectangular
  89. section of the display) open in the windowing-system you are running
  90. Jade in.
  91.  
  92.    Windows have two main functions, firstly to provide a means of seeing
  93. the contents of a buffer and secondly to receive input events. For more
  94. details about event handling see *Note Event Loop::.
  95.  
  96.    A window *always* displays a buffer and there is *always* at least
  97. one window open. The editor remembers which of the open windows is the
  98. "current window", this is normally the window it last received an input
  99. event from, though it can be set by programs.
  100.  
  101.    For some basic details about using windows see *Note Using Windows::.
  102.  
  103.  - Function: windowp OBJECT
  104.      This function returns `t' if its argument is a window.
  105.  
  106.  - Variable: window-list
  107.      This variable's value is a list of all the currently open windows.
  108.      The order of the elements in the list is insignificant.
  109.  
  110.           window-list
  111.               => (#<window 20971528 *Info*> #<window 20971524 *jade*>)
  112.  
  113. * Menu:
  114.  
  115. * Opening Windows::             Creating new windows
  116. * Closing Windows::             Deleting windows
  117. * Iconifying Windows::          Temporarily removing windows
  118. * Displaying Messages::         Messages to the user
  119. * The Current Window::          The activated window, used by default
  120. * Window Font::                 Each window may use a different font
  121. * Window Information::          Details of a window's current state
  122. * Rendering::                   How buffers are drawn in windows
  123. * Block Marking::               Highlighting a region of a window
  124.  
  125. 
  126. File: jade.info,  Node: Opening Windows,  Next: Closing Windows,  Up: Windows
  127.  
  128. Opening Windows
  129. ---------------
  130.  
  131.  - Function: open-window &optional BUFFER X Y WIDTH HEIGHT
  132.      Opens a new window and returns it. If BUFFER is defined it is the
  133.      buffer to display in the new window, otherwise the current buffer
  134.      is displayed.
  135.  
  136.      The X and Y arguments are the pixel coordinates of the new window's
  137.      top left corner in the display. The WIDTH and HEIGHT arguments are
  138.      the size of the window in columns and rows of characters
  139.      respectively.
  140.  
  141.      What happens when the position and size of the window is undefined
  142.      will depend on the underlying window system, on the Amiga the
  143.      window will probably be the same as the current window, in X11 the
  144.      window manager will probably let the user size it interactively.
  145.  
  146.      The new window will have its `buffer-list' variable initialised
  147.      suitably and it will be added to the head of the `window-list'
  148.      variable.
  149.  
  150.    The `make-window' function is the lowest level of creating a new
  151. window, `open-window' uses it to open the window.
  152.  
  153.  - Function: make-window &optional X Y WIDTH HEIGHT
  154.      Creates a new window and returns it, the arguments are similar to
  155.      those of the same name in the `open-window' function. The window
  156.      will display the current buffer.
  157.  
  158.      After the window is created the `make-window-hook' will be called
  159.      with the window as its argument.
  160.  
  161.  - Hook: make-window-hook
  162.      Hook called each time a new window is created. It has one
  163.      argument, the new window.
  164.  
  165.  - Variable: pub-screen
  166.      This window-local variable is only used on the Amiga version of
  167.      Jade; it holds the name of the public screen which windows are
  168.      opened on. By default this is the Workbench screen.
  169.  
  170.      When a window is opened it inherits this value from the current
  171.      window at the time.
  172.  
  173. 
  174. File: jade.info,  Node: Closing Windows,  Next: Iconifying Windows,  Prev: Opening Windows,  Up: Windows
  175.  
  176. Closing Windows
  177. ---------------
  178.  
  179.    Unlike buffers, window objects don't have indefinite extent, even
  180. when a window is incapable of being referenced the object will not be
  181. destroyed by the garbage collector; count the user looking at the window
  182. as a reference!
  183.  
  184.    When the window is closed (by the `destroy-window' function) the
  185. object loses its `window-ness' and the garbage collector is free to
  186. reclaim its memory.
  187.  
  188.  - Function: close-window &optional WINDOW
  189.      This function closes the window WINDOW (or the current window) and
  190.      deletes its entry from the `window-list' variable.
  191.  
  192.      If this window is the only one the editor has open the user is
  193.      asked if it's okay to lose any modified buffers before the window
  194.      is closed.
  195.  
  196.  - Function: close-other-windows &optional WINDOW
  197.      Uses `close-window' to close all windows except WINDOW (or the
  198.      current window).
  199.  
  200.  - Function: destroy-window WINDOW
  201.      Closes the window WINDOW. After a window object has been closed it
  202.      is no longer a member of the type `window'.
  203.  
  204.      Before closing the window the `destroy-window-hook' is evaluated
  205.      with the window being destroyed as an argument.
  206.  
  207.      When the last window is closed the editor will exit automatically.
  208.  
  209.      Like the `destroy-buffer' function, this function is dangerous if
  210.      used carelessly.
  211.  
  212.      Both `close-window' and `close-other-windows' eventually call this
  213.      function.
  214.  
  215.  - Hook: destroy-window-hook
  216.      Hook called by `destroy-window' before it does anything. It has
  217.      one argument -- the window to be destroyed.
  218.  
  219. 
  220. File: jade.info,  Node: Iconifying Windows,  Next: Displaying Messages,  Prev: Closing Windows,  Up: Windows
  221.  
  222. Iconifying Windows
  223. ------------------
  224.  
  225.    When you don't want a window cluttering the display, but don't want
  226. to kill it totally it can be iconified; the window will be displayed as
  227. a small icon which can be reactivated when the window is wanted again.
  228.  
  229.  - Function: sleep-window &optional WINDOW
  230.      Iconifies the specified window.
  231.  
  232.  - Function: unsleep-window &optional WINDOW
  233.      Uniconifies the specified window. This may be done automatically if
  234.      the user needs to be prompted.
  235.  
  236.  - Function: toggle-iconic
  237.      Toggles the current window between the iconified and normal
  238.      states. This command is bound to the key sequence `Ctrl-z'.
  239.  
  240.  - Function: window-asleep-p
  241.      Returns `t' when the current window is iconified.
  242.  
  243. 
  244. File: jade.info,  Node: Displaying Messages,  Next: The Current Window,  Prev: Iconifying Windows,  Up: Windows
  245.  
  246. Displaying Messages
  247. -------------------
  248.  
  249.    Often it is useful to be able to show the user a short one-line
  250. message, this is what the `message' function does.
  251.  
  252.  - Function: message MESSAGE &optional DISPLAY-NOW
  253.      This function displays the string MESSAGE in the status line of
  254.      the current window, then returns MESSAGE.
  255.  
  256.      If DISPLAY-NOW is non-`nil' the message is rendered into the
  257.      window immediately, otherwise it will not be visible until the next
  258.      general redisplay (usually after each command exits).
  259.  
  260.    Note that an alternate way of writing in the status line is to use
  261. the output stream `t'. *Note Output Streams::.
  262.  
  263.    When writing interactive programs it is sometimes useful to be able
  264. to render the cursor in the status line. This shows that the next key
  265. press will not be subject to normal editing key bindings but to the
  266. special user interface (usually explained by a message in the status
  267. line).
  268.  
  269.    For example the `y-or-n-p' function uses this technique to show that
  270. it needs an answer.
  271.  
  272.  - Variable: status-line-cursor
  273.      When this window-local variable is non-`nil' the window's cursor is
  274.      rendered at the end of the message in the status line, not at the
  275.      cursor's position in the main display.
  276.  
  277.    Another way of alerting the user is to use the `beep' function,
  278.  
  279.  - Function: beep
  280.      This function rings a bell or flashes the current window or screen
  281.      depending on your system.
  282.  
  283. 
  284. File: jade.info,  Node: The Current Window,  Next: Window Font,  Prev: Displaying Messages,  Up: Windows
  285.  
  286. The Current Window
  287. ------------------
  288.  
  289.    The current window is the window that functions operate on by
  290. default; every time the event loop receives some input from the user
  291. the window which the input event originated in becomes the current
  292. window. It is also possible for Lisp programs to set the current
  293. window, either permanently or temporarily.
  294.  
  295.    The "active window" is the window which the windowing system will
  296. send any keyboard input to. Since Jade sets the current window to where
  297. it receives input from, it is often the case that the current window is
  298. the same as the active window. Jade also provides the means to set the
  299. active window; in some cases this may be best left to the user though.
  300.  
  301.  - Function: current-window
  302.      This function returns the current window.
  303.  
  304.           (current-window)
  305.               => #<window 20971524 programmer.texi>
  306.  
  307.  - Function: set-current-window WINDOW &optional ACTIVATE
  308.      This function sets the current window to be the window WINDOW. If
  309.      the optional argument ACTIVATE is non-`nil' this window will also
  310.      become the active window.
  311.  
  312.      When using the ACTIVATE argument bear in mind that it may be
  313.      confusing for the user if the active window is suddenly changed;
  314.      only change the active window synchronously with some input from
  315.      the user.
  316.  
  317.  - Special Form: with-window WINDOW FORMS...
  318.      Temporarily sets the current window to the value of evaluating the
  319.      form WINDOW, then uses an implicit progn to evaluate the FORMS. The
  320.      old current window is then reinstated before returning the value
  321.      of the implicit progn.
  322.  
  323. 
  324. File: jade.info,  Node: Window Font,  Next: Window Information,  Prev: The Current Window,  Up: Windows
  325.  
  326. Window Font
  327. -----------
  328.  
  329.    Each window may use a different font; this font will be used for
  330. rendering all text in the window. When windows are created they inherit
  331. their font from the current window at the time.
  332.  
  333.    Currently Jade only allows the use of fixed-width fonts; proportional
  334. fonts won't work properly.
  335.  
  336.  - Command: set-font FONT-NAME &optional WINDOW
  337.      This function sets the font used in the window WINDOW (or the
  338.      current window) to the font named by the string FONT-NAME.
  339.  
  340.      The format of the string FONT-NAME depends on the underlying
  341.      windowing system:
  342.  
  343.     X11
  344.           Simply use the standard name of the font, asterisk characters
  345.           work like usual (i.e. match zero or more characters).
  346.  
  347.     Amiga
  348.           This is different to the normal Amiga conventions, use the
  349.           name of the font followed by a dash and then the size of the
  350.           font. For example to get an 8-point topaz font, use
  351.           `topaz.font-8'.
  352.  
  353.      When this function is called interactively it will prompt for
  354.      FONT-NAME.
  355.  
  356.  - Function: font-name &optional WINDOW
  357.      Returns the name of the font being used in the specified window.
  358.  
  359.      Note that on an Amiga this will only return the name, and not the
  360.      size of the font. For example, if `set-font' has been used with an
  361.      argument of `"topaz.font-8"', a call to `font-name' would produce
  362.      `"topaz.font"'.
  363.  
  364.  - Function: font-x-size &optional WINDOW
  365.      Returns the width (in pixels) of a character in the specified
  366.      window's font.
  367.  
  368.           (font-x-size)
  369.               => 7
  370.  
  371.  - Function: font-y-size &optional WINDOW
  372.      Returns the height in pixels of each character in the window's
  373.      font.
  374.  
  375.           (font-y-size)
  376.               => 13
  377.  
  378. 
  379. File: jade.info,  Node: Window Information,  Next: Rendering,  Prev: Window Font,  Up: Windows
  380.  
  381. Window Information
  382. ------------------
  383.  
  384.    There are a number of functions which provide information about the
  385. current state of a window.
  386.  
  387.  - Function: window-id &optional WINDOW
  388.      Returns an integer which is the window system's `handle' on the
  389.      window WINDOW (or the current window). Under X11 this is the Window
  390.      identifier, on an Amiga it's a pointer to the window's `struct
  391.      Window'.
  392.  
  393.           (window-id)
  394.               => 20971524
  395.  
  396.  - Function: window-count
  397.      Returns the number of currently-opened windows.
  398.  
  399.  - Function: screen-width
  400.      Returns the width of the root window or screen in pixels.
  401.  
  402.  - Function: screen-height
  403.      Returns the height in pixels of the root window.
  404.  
  405.  - Function: window-left-edge
  406.      Returns the x coordinate of the current window relative to the root
  407.      window's top-left corner.
  408.  
  409.  - Function: window-top-edge
  410.      The y coordinate of the current window relative to the root
  411.      window's top-left corner.
  412.  
  413.  - Function: window-width
  414.      Returns the width, in pixels, of the current window.
  415.  
  416.  - Function: window-height
  417.      Returns the height in pixels of the current window.
  418.  
  419.  - Function: window-bar-height
  420.      Only used by Amigas, this returns the height of the current
  421.      window's title bar. This will always be zero in X.
  422.  
  423.  - Function: screen-top-line
  424.      Returns the line number of the first line being shown in the
  425.      current window.
  426.  
  427.  - Function: screen-bottom-line
  428.      Returns the line number of the last line being shown in the
  429.      current window.
  430.  
  431.  - Function: screen-first-column
  432.      Returns the column number of the first column being shown in the
  433.      current window.
  434.  
  435.  - Function: screen-last-column
  436.      Returns the column number of the last column being shown in the
  437.      current window.
  438.  
  439. 
  440. File: jade.info,  Node: Rendering,  Next: Block Marking,  Prev: Window Information,  Up: Windows
  441.  
  442. Rendering
  443. ---------
  444.  
  445.    After each command is executed a full redisplay is done; the display
  446. of each window is made to be consistent with the contents of the buffer
  447. it is showing.
  448.  
  449.  - Function: refresh-all
  450.      This function calls the redisplay code, any windows, whose display
  451.      is inconsistent with what it should be displaying, are updated.
  452.  
  453.  - Function: cursor ON
  454.      Turns the cursor in the current window on or off (depending on
  455.      whether ON is non-`nil' or not). Normally the cursor is erased
  456.      while Lisp programs are executing.
  457.  
  458.      If you use this function be sure to leave the cursor undrawn when
  459.      you've finished.
  460.  
  461.  - Function: centre-display &optional WINDOW
  462.      If possible, this function will arrange it so that the line which
  463.      the cursor is on (*note The Cursor Position::.) will be in the
  464.      centre of the display.
  465.  
  466.  - Function: next-screen &optional COUNT
  467.      Move COUNT (or 1 by default) screens forwards in the display, Lisp
  468.      programs shouldn't need to call this.
  469.  
  470.  - Function: prev-screen &optional COUNT
  471.      Move COUNT screens backwards in the display. Don't call this from
  472.      Lisp programs.
  473.  
  474.  - Function: flush-output
  475.      This function forces any locally-cached rendering operations to be
  476.      drawn into the actual window. This should be called after any use
  477.      of the `refresh-all' or `cursor' functions.
  478.  
  479.      Currently this function only actually does anything in the X11
  480.      version of Jade (it calls XFlush()), but to ensure the portability
  481.      of Lisp programs it should be used anyway.
  482.  
  483.  - Variable: max-scroll
  484.      This window-local variable defines the maximum number of lines
  485.      which may be scrolled in one go; if more than this number of lines
  486.      have to be moved when a redisplay happens the whole window will be
  487.      redrawn.
  488.  
  489.  - Variable: y-scroll-step-ratio
  490.      This window-local variable controls the actual number of lines
  491.      scrolled when the cursor moves out of the visible part of the
  492.      window. The number of lines to move the display origin is
  493.      calculated with the formula:
  494.  
  495.           (/ TOTAL-LINES-IN-WINDOW y-scroll-step-ratio)
  496.  
  497.      If the variable's value is zero then the window will be scrolled
  498.      by the least number of lines necessary to get the cursor back into
  499.      the visible part.
  500.  
  501.  - Variable: x-scroll-step-ratio
  502.      Similar to `y-scroll-step-ratio', except that it's used when the
  503.      cursor disappears to the left or the right of the display.
  504.  
  505. 
  506. File: jade.info,  Node: Block Marking,  Prev: Rendering,  Up: Windows
  507.  
  508. Block Marking
  509. -------------
  510.  
  511.    Each window may define one "block", this is a region of the buffer
  512. displayed in the window which is rendered in the opposite colours to
  513. normal (i.e. the same as the normal cursor, when the cursor is in a
  514. block it's drawn in the inverse of the block). Blocks are primarily
  515. used for marking areas of a buffer which will subsequently be
  516. manipulated.
  517.  
  518.    Normally the area of the buffer contained by a block is delimited by
  519. two positions; the start and end of the block (these will track changes
  520. made to the buffer and adjust themselves, like marks do). It is also
  521. possible to mark rectangular blocks; these are also delimited by two
  522. positions, but they define the two opposite corners of the rectangular
  523. block.
  524.  
  525.  - Function: blockp
  526.      Returns `t' if a block is marked in the current window.
  527.  
  528.  - Function: mark-block START-POS END-POS
  529.      Define the beginning and end markers of the block to display in the
  530.      current window.
  531.  
  532.  - Command: block-kill
  533.      Unmark the block displayed in the current window.
  534.  
  535.  - Command: mark-word COUNT &optional POS
  536.      Mark COUNT words from POS (or the cursor pos) in the current
  537.      window.
  538.  
  539.  - Command: mark-whole-buffer
  540.      Mark the whole of the current buffer.
  541.  
  542.  - Function: block-start
  543.      Returns the position of the beginning of the block marked in the
  544.      current window. If no block is defined returns `nil'.
  545.  
  546.  - Function: block-end
  547.      Returns the position of the end of the block, or `nil' if no block
  548.      is defined in the current window.
  549.  
  550.  - Command: block-toggle
  551.      Toggles between marking the beginning, marking the end and totally
  552.      unmarking the block in the current window.
  553.  
  554.  - Function: rect-blocks-p &optional WINDOW
  555.      Returns `t' if the block marked in the window is drawn as a
  556.      rectangle.
  557.  
  558.  - Function: set-rect-blocks WINDOW STATUS
  559.      Defines whether or not the block drawn in WINDOW is drawn as a
  560.      rectangle or not. If STATUS is `nil' it isn't.
  561.  
  562.  - Command: toggle-rect-blocks
  563.      Toggles between marking normal and rectangular blocks in the
  564.      current window.
  565.  
  566. 
  567. File: jade.info,  Node: Positions,  Next: Marks,  Prev: Windows,  Up: Programming Jade
  568.  
  569. Positions
  570. =========
  571.  
  572.    A "position" is a Lisp object representing the location of one of the
  573. characters in the contents of a buffer (*note Buffers::.). Since Jade
  574. stores buffer contents as an array of lines, two index values are
  575. needed to reference a single character. A position object contains two
  576. integers; the column and line numbers of the character, both these
  577. values count upwards from zero (i.e. the first character in a buffer
  578. has line and column numbers of zero).
  579.  
  580.    Position objects have no read syntax; they print as,
  581.  
  582.      #<pos COLUMN LINE>
  583.  
  584.  - Function: posp OBJECT
  585.      This function returns `t' when its argument is a position object.
  586.  
  587.  - Function: pos COLUMN LINE
  588.      Creates and returns a new position object, it points to column
  589.      number COLUMN and line number LINE (both integers).
  590.  
  591.  - Function: copy-pos POS
  592.      Creates a new copy of the position object POS.
  593.  
  594. * Menu:
  595.  
  596. * Position Components::         Accessing the members of a position
  597. * The Cursor Position::         Where the cursor is drawn in the display
  598. * Movement Functions::          Position-motion functions
  599. * Positions and Offsets::       Converting between positions and buffer
  600.                                   offsets
  601.  
  602. 
  603. File: jade.info,  Node: Position Components,  Next: The Cursor Position,  Up: Positions
  604.  
  605. Position Components
  606. -------------------
  607.  
  608.    As previously noted, each position object has two components; one
  609. number defining the column, the other defining the line that the
  610. position represents. These components can be accessed individually.
  611.  
  612.  - Function: pos-col POS
  613.      Returns the column which the position object POS points to.
  614.  
  615.           (pos-col (pos 1 2))
  616.               => 1
  617.  
  618.  - Function: pos-line POS
  619.      This function returns the line number which POS points to.
  620.  
  621.  - Function: set-pos-col POS NEW-COL
  622.      Sets the number of the column which the position object POS points
  623.      to, to NEW-COL (an integer), then returns col.
  624.  
  625.           (setq x (pos 1 2))
  626.               => #<pos 1 2>
  627.           (set-pos-col x 3)
  628.               => 3
  629.           x
  630.               => #<pos 3 2>
  631.  
  632.  - Function: set-pos-line POS NEW-LINE
  633.      Similar to `set-pos-col' except the line number is modified.
  634.  
  635. 
  636. File: jade.info,  Node: The Cursor Position,  Next: Movement Functions,  Prev: Position Components,  Up: Positions
  637.  
  638. The Cursor Position
  639. -------------------
  640.  
  641.    Each window displays a "cursor", this is rendered as a character in
  642. the opposite colour to what it would usually be (i.e. normally a dark
  643. rectangle). The cursor is used to show the user where any characters
  644. they type will be inserted, each window has a separate cursor position
  645. and buffers which are not being displayed `remember' the last position
  646. of their cursor.
  647.  
  648.  - Function: cursor-pos
  649.      This function returns a copy of the cursor position in the current
  650.      window.
  651.  
  652.           (cursor-pos)
  653.               => #<pos 14 5638>
  654.  
  655.  - Function: goto-char POS
  656.      Sets the position of the current window's cursor to the position
  657.      object POS, then returns POS.
  658.  
  659.      Note that the components of POS are *copied*, any subsequent
  660.      modification of POS will not affect the cursor.
  661.  
  662.      If the line number of POS points to a non-existent line the cursor
  663.      won't be moved and `nil' will be returned.
  664.  
  665. 
  666. File: jade.info,  Node: Movement Functions,  Next: Positions and Offsets,  Prev: The Cursor Position,  Up: Positions
  667.  
  668. Movement Functions
  669. ------------------
  670.  
  671.    This section documents the functions which are used to create and
  672. modify position objects so that they point to a different position
  673. which is related to the original position in some way.
  674.  
  675.    The functions which begin `goto-' set the cursor position of the
  676. current window to the new position; the others do *not* move the
  677. cursor, they simply calculate the new position and return it.
  678.  
  679.    In some cases the position argument itself will be modified and
  680. returned, this may cause confusion; if there are existing references to
  681. the object they subtle bugs may result. Consider the following,
  682.  
  683.      (setq x (cursor-pos)
  684.            y (next-char 1 x))
  685.  
  686.    At first glance this looks as though the variable `y' will point to
  687. one character after the variable `x' does. Since the `next-char'
  688. function *modifies* its argument position *both* variables will contain
  689. the same object, and therefore, point to the same position.
  690.  
  691.    A solution is,
  692.  
  693.      (setq x (cursor-pos)
  694.            y (next-char 1 (copy-pos x)))
  695.  
  696.    Read each function's description carefully to see if it alters its
  697. arguments!
  698.  
  699. * Menu:
  700.  
  701. * Buffer Extremes::             The edges of a buffer
  702. * Character Movement::          Moving in terms of characters,
  703. * Word Movement::               or maybe words,
  704. * Tab Movement::                tabs,
  705. * Line Movement::               lines,
  706. * Expression Movement::         or even expressions.
  707.  
  708. 
  709. File: jade.info,  Node: Buffer Extremes,  Next: Character Movement,  Up: Movement Functions
  710.  
  711. Buffer Extremes
  712. ...............
  713.  
  714.  - Function: buffer-end &optional BUFFER
  715.      Create and return a new position object pointing to the character
  716.      after the last character in the buffer.
  717.  
  718.  - Function: goto-buffer-end
  719.      Set the cursor to the character after the last character in the
  720.      current buffer.
  721.  
  722.  - Function: buffer-start &optional BUFFER
  723.      Create a new position pointing to the first character in the
  724.      buffer. Currently this is always the position `#<pos 0 0>' and the
  725.      BUFFER argument is ignored.
  726.  
  727.  - Function: goto-buffer-start
  728.      Set the cursor position to the first character in the buffer.
  729.  
  730. 
  731. File: jade.info,  Node: Character Movement,  Next: Word Movement,  Prev: Buffer Extremes,  Up: Movement Functions
  732.  
  733. Character Movement
  734. ..................
  735.  
  736.  - Function: left-char &optional COUNT POS
  737.      Alter and return POS (or a copy of the cursor pos) so that it
  738.      points COUNT characters (default is one) to the left of its
  739.      current position.  If the resulting column number is less than
  740.      zero `nil' is returned, else the position.
  741.  
  742.           (goto-char (pos 20 0))
  743.               => #<pos 20 0>
  744.           (left-char)
  745.               => #<pos 19 0>
  746.           
  747.           (setq x (pos 4 1))
  748.               => #<pos 4 1>
  749.           (left-char 3 x)
  750.               => #<pos 1 1>
  751.           x
  752.               => #<pos 1 1>
  753.  
  754.  - Function: goto-left-char &optional COUNT
  755.      Move COUNT (or one) characters to the left.
  756.  
  757.  - Function: right-char &optional COUNT POS
  758.      Alter and return POS (or a copy of the cursor pos) so that it
  759.      points COUNT (or one) characters to the right of its current
  760.      position. May return a position which points to a character past
  761.      the end of the line.
  762.  
  763.  - Function: goto-right-char &optional COUNT
  764.      Move COUNT (or one) characters to the right.
  765.  
  766.    The following functions results depends on the contents of the buffer
  767. they are operating on; they move a certain number of *characters*, and
  768. hence will cross line boundaries.
  769.  
  770.  - Function: next-char &optional COUNT POS BUFFER
  771.      Alter and return POS (or a copy of the cursor pos) to point to the
  772.      character COUNT characters in front of its current position.
  773.  
  774.      If COUNT is negative this function will work backwards through the
  775.      buffer.
  776.  
  777.  - Function: goto-next-char &optional COUNT
  778.      Move COUNT characters forwards.
  779.  
  780.  - Function: prev-char &optional COUNT POS BUFFER
  781.      Similar to the `next-char' function but will work backwards when
  782.      COUNT is positive and forwards when it is negative.
  783.  
  784.  - Function: goto-prev-char COUNT
  785.      Move COUNT characters backwards.
  786.  
  787. 
  788. File: jade.info,  Node: Word Movement,  Next: Tab Movement,  Prev: Character Movement,  Up: Movement Functions
  789.  
  790. Word Movement
  791. .............
  792.  
  793.    There are two buffer-local variables which control the syntax of
  794. words in each buffer.
  795.  
  796.  - Variable: word-regexp
  797.      This buffer-local variable contains a regular expression which
  798.      will match each character allowed to be in a word.
  799.  
  800.      The standard value is `[a-zA-Z0-9]', i.e. all alphanumeric
  801.      characters.
  802.  
  803.  - Variable: word-not-regexp
  804.      A buffer-local variable. Holds a regular expression which will
  805.      match anything not in a word.
  806.  
  807.      The normal value is `[^a-zA-Z0-9]|$', i.e. anything which is not
  808.      alphanumeric or the end of a line.
  809.  
  810.    The following functions use these variables when deciding what is and
  811. what isn't a word.
  812.  
  813.  - Function: forward-word &optional COUNT POS MOVE
  814.      Return the position of the first character after the end of the
  815.      word at position POS (or the cursor).  COUNT is the number of
  816.      words to move, negative values mean go backwards.
  817.  
  818.      If MOVE is non-`nil' then the cursor is moved to the result.
  819.  
  820.      Note that POS is not altered.
  821.  
  822.  - Function: backward-word &optional COUNT POS MOVE
  823.      Similar to `forward-word' except that it works backwards. In fact,
  824.      all this function does is call `forward-word' with COUNT negated.
  825.  
  826.  - Function: word-start &optional POS
  827.      Returns the position of the first character of the word at POS (or
  828.      the cursor position).
  829.  
  830.  - Function: in-word-p &optional POS
  831.      This function returns `t' if POS (or the cursor) is in a word.
  832.  
  833. 
  834. File: jade.info,  Node: Tab Movement,  Next: Line Movement,  Prev: Word Movement,  Up: Movement Functions
  835.  
  836. Tab Movement
  837. ............
  838.  
  839.  - Function: prev-tab &optional COUNT POS SIZE
  840.      Alter and return POS (or a copy of the cursor position) so that it
  841.      points COUNT (default is one) tab stops to the left of its current
  842.      position. Returns `nil' if that position is before the start of
  843.      the line.
  844.  
  845.      SIZE is optionally the number of glyphs in each tab, or the value
  846.      of the `tab-size' variable.
  847.  
  848.      Note that the position returned is not the position of a character
  849.      but of a glyph (*note Glyph Positions::.).
  850.  
  851.           (prev-tab 1 (pos 20 0))
  852.               => #<pos 16 0>
  853.  
  854.  - Function: goto-prev-tab &optional COUNT SIZE
  855.      Move COUNT tab stops to the left.
  856.  
  857.  - Function: next-tab &optional COUNT POS SIZE
  858.      Alter and return POS (or a copy of the cursor position) so that it
  859.      points COUNT tab stops to the right of its current position.
  860.  
  861.      SIZE is optionally the number of glyphs in each tab, or the value
  862.      of the `tab-size' variable.
  863.  
  864.      Note that the position returned is not the position of a character
  865.      but of a glyph (*note Glyph Positions::.).
  866.  
  867.  - Function: goto-next-tab &optional COUNT SIZE
  868.      Move COUNT tab stops to the right.
  869.  
  870. 
  871. File: jade.info,  Node: Line Movement,  Next: Expression Movement,  Prev: Tab Movement,  Up: Movement Functions
  872.  
  873. Line Movement
  874. .............
  875.  
  876.  - Function: next-line &optional COUNT POS
  877.      Alter and return POS (or a copy of the cursor position) so that it
  878.      points COUNT (or one) lines forwards, the column component is not
  879.      changed.
  880.  
  881.      If COUNT is negative (i.e. go backwards) and the resulting line
  882.      number is less than zero `nil' is returned.
  883.  
  884.           (next-line 2 (pos 1 1))
  885.               => #<pos 1 3>
  886.           
  887.           (next-line -1 (pos 1 1))
  888.               => #<pos 1 0>
  889.  
  890.  - Function: goto-next-line &optional COUNT
  891.      Move COUNT lines downwards, the column number of the cursor is
  892.      adjusted so that its glyph position is as close to its previous
  893.      glyph position as possible.
  894.  
  895.  - Function: prev-line &optional COUNT POS
  896.      Similar to NEXT-LINE but goes backwards (or forwards with a
  897.      negative COUNT).
  898.  
  899.  - Function: goto-prev-line &optional COUNT
  900.      Move COUNT lines backwards, adjusting the column number of the
  901.      cursor as necessary.
  902.  
  903. 
  904. File: jade.info,  Node: Expression Movement,  Prev: Line Movement,  Up: Movement Functions
  905.  
  906. Expression Movement
  907. ...................
  908.  
  909.    Some major modes provide functions to move backwards and forwards
  910. over expressions written in a buffer in the programming language that
  911. the mode supports (*note Mode-Specific Expressions::.), for example the
  912. Lisp mode defines the syntax of Lisp forms written in a buffer.
  913.  
  914.  - Function: forward-exp &optional COUNT
  915.      This function moves the cursor over COUNT expressions, as defined
  916.      in the current buffer. If the buffer has no expression definitions
  917.      an error is signalled.
  918.  
  919.  - Function: backward-exp &optional COUNT
  920.      Moves backwards over COUNT (or one) expressions, leaving the cursor
  921.      at the beginning of the expression. If the buffer has no
  922.      expression definition functions an error is signalled.
  923.  
  924. 
  925. File: jade.info,  Node: Positions and Offsets,  Prev: Movement Functions,  Up: Positions
  926.  
  927. Positions and Offsets
  928. ---------------------
  929.  
  930.    Although Jade stores the position of a character as a pair of two
  931. numbers many other programs define the position of a character as its
  932. offset from the beginning of the buffer or file it is in. The following
  933. functions may be used to convert between these two types of positions
  934. in a specified buffer.
  935.  
  936.  - Function: pos-to-offset &optional POS BUFFER
  937.      This function returns the offset of the character at the position
  938.      POS (or the cursor position by default) in the specified buffer.
  939.      This will be an integer, the first character in a buffer is
  940.      represented by an offset of zero.
  941.  
  942.           (pos-to-offset (pos 0 0))
  943.               => 0
  944.           
  945.           (pos-to-offset)
  946.               => 195654
  947.  
  948.  - Function: offset-to-pos OFFSET &optional BUFFER
  949.      Creates a new position object which contains the position of the
  950.      character OFFSET characters from the start of the specified buffer.
  951.  
  952.           (offset-to-pos 0)
  953.               => #<pos 0 0>
  954.           
  955.           (offset-to-pos 195654)
  956.               => #<pos 14 5974>
  957.  
  958. 
  959. File: jade.info,  Node: Marks,  Next: Glyph Tables,  Prev: Positions,  Up: Programming Jade
  960.  
  961. Marks
  962. =====
  963.  
  964.    A "mark" is a Lisp object which points to a character in a file (or
  965. buffer), as the buffer the file is stored in is modified the position
  966. the mark points to is also modified so that the mark will *always*
  967. point to the same character.
  968.  
  969.    The character that a mark points to does not have to be loaded into
  970. the editor all the time either; if the file the character is in is not
  971. resident in a buffer the mark will simply contain the character's
  972. position and the file's name. When a file is loaded any marks pointing
  973. to the file are altered so that they point straight to the buffer
  974. containing the file.
  975.  
  976.  - Function: markp OBJECT
  977.      This function returns `t' if its argument is a mark.
  978.  
  979. * Menu:
  980.  
  981. * Mark Components::             Marks contain two values; position and file
  982. * Mark Relocation::             How the position of a mark is updated as
  983.                                   its buffer is modified
  984. * Mark Residency::              Marks may point to files which have not
  985.                                   been loaded
  986. * Creating Marks::              Functions to allocate new mark objects
  987. * Altering Marks::              Setting the components of a mark
  988. * Moving to Marks::             Moving the cursor to the character a
  989.                                   mark points to
  990.  
  991. 
  992. File: jade.info,  Node: Mark Components,  Next: Mark Relocation,  Up: Marks
  993.  
  994. Mark Components
  995. ---------------
  996.  
  997.    Each mark object has two main components; the position of the
  998. character pointed to by the mark (a position object) and the file which
  999. the character is contained by.
  1000.  
  1001.    The file is the most complex component, it can be either a string
  1002. naming the file or a buffer. When the file component is a string the
  1003. mark is said to be "non-resident" since none of the editor buffers
  1004. contain the character which the mark points to.
  1005.  
  1006.  - Function: mark-pos MARK
  1007.      Returns the position object contained in the marker MARK, no copy
  1008.      is made: if you modify the position returned it will be reflected
  1009.      in the position of the mark.
  1010.  
  1011.      Note that if you later modify the buffer the mark is resident in
  1012.      the position previously returned by `mark-pos' may be altered by
  1013.      the mark relocation process. *Note Mark Relocation::.
  1014.  
  1015.  - Function: mark-file MARK
  1016.      Returns the file component of MARK. This will be either the name of
  1017.      the file or the buffer itself depending on whether the mark is
  1018.      resident or not. *Note Mark Residency::.
  1019.  
  1020. 
  1021. File: jade.info,  Node: Mark Relocation,  Next: Mark Residency,  Prev: Mark Components,  Up: Marks
  1022.  
  1023. Mark Relocation
  1024. ---------------
  1025.  
  1026.    An important feature of marks is that they always point to the same
  1027. character, even when the buffer has been modified, changing the position
  1028. of the character (i.e. if some text is deleted from somewhere before the
  1029. character its position will probably change).
  1030.  
  1031.    Every time a buffer is modified each mark which points to a character
  1032. in that buffer is examined and then, if necessary, the position it
  1033. points to is changed to take account of the buffer's new state.
  1034.  
  1035.    Basically, what happens is that each mark will try to point at the
  1036. same character all the time. If some text is inserted at the position
  1037. of the mark the mark's position will be advanced to the end of the
  1038. insertion and hence the original character.
  1039.  
  1040.    The only time the mark will not point at the same character is when
  1041. the character is deleted from the buffer. In this case the mark will
  1042. point to the start of the deletion.
  1043.  
  1044. 
  1045. File: jade.info,  Node: Mark Residency,  Next: Creating Marks,  Prev: Mark Relocation,  Up: Marks
  1046.  
  1047. Mark Residency
  1048. --------------
  1049.  
  1050.    As I have already explained, a mark does not necessarily have to
  1051. point at a character loaded into a buffer; it can also point at a
  1052. character in a file on disk somewhere. When this happens the mark is
  1053. said to be non-resident.
  1054.  
  1055.  - Function: mark-resident-p MARK
  1056.      This function returns `t' when the character pointed to by the
  1057.      marker MARK is resident in one of the editor's buffers.
  1058.  
  1059.    When the function `mark-file' (*note Mark Components::.) is applied
  1060. to a non-resident mark it returns the full name of the file, for
  1061. example,
  1062.  
  1063.      (setq x (make-mark (pos 0 20) "/tmp/foo.c"))
  1064.          => #<mark "/tmp/foo.c" #<pos 1 21>>
  1065.      (mark-resident-p x)
  1066.          => nil
  1067.      (mark-file x)
  1068.          => "/tmp/foo.c"
  1069.  
  1070.    When a file is loaded into a buffer all existing non-resident marks
  1071. are examined to see if they point to that file. If so that mark has its
  1072. file component set to the buffer that the file was loaded into.
  1073.  
  1074.    Similarly, when a buffer is deleted any marks pointing to characters
  1075. in that buffer are made non-resident: their file component is set to the
  1076. name of the file.
  1077.  
  1078.    When the function which moves the cursor to the position of a
  1079. specific mark (`goto-mark', *note Moving to Marks::.) is called with a
  1080. non-resident mark it will try to load the file into a buffer.
  1081.  
  1082.    The following code fragment can be used to ensure that a mark MARK
  1083. is resident,
  1084.  
  1085.      (or (mark-resident-p MARK)
  1086.          (open-file (mark-file MARK))
  1087.          (error "Can't make mark resident, %S" MARK))
  1088.  
  1089. 
  1090. File: jade.info,  Node: Creating Marks,  Next: Altering Marks,  Prev: Mark Residency,  Up: Marks
  1091.  
  1092. Creating Marks
  1093. --------------
  1094.  
  1095.  - Function: make-mark &optional POS BUFFER-OR-FILENAME
  1096.      This function allocates a new mark object and fills it in according
  1097.      to the supplied arguments.
  1098.  
  1099.      It will point at a character at position POS, or the position of
  1100.      the cursor in the current window. Note that a copy of POS is made.
  1101.  
  1102.      The BUFFER-OR-FILENAME argument specifies the file component of the
  1103.      mark. If BUFFER-OR-FILENAME is a buffer (`nil' or undefined means
  1104.      the current buffer) the mark will use it and therefore will be
  1105.      resident (*note Mark Residency::.).
  1106.  
  1107.      Alternatively, BUFFER-OR-FILENAME can be a string naming the file
  1108.      explicitly. If the file is already loaded into a buffer that
  1109.      buffer will be used and the mark will be resident. Otherwise the
  1110.      mark will be non-resident and the string will be used as the file
  1111.      component.
  1112.  
  1113.      With no arguments this function will produce a resident mark
  1114.      pointing at the cursor in the current buffer.
  1115.  
  1116.           (make-mark)
  1117.               => #<mark #<buffer programmer.texi> #<pos 46 6152>>
  1118.           
  1119.           (make-mark (buffer-start) "/tmp/foo")
  1120.               => #<mark "/tmp/foo" #<pos 0 0>>
  1121.           
  1122.           (make-mark (pos 0 3))
  1123.               => #<mark #<buffer programmer.texi> #<pos 0 3>>
  1124.  
  1125. 
  1126. File: jade.info,  Node: Altering Marks,  Next: Moving to Marks,  Prev: Creating Marks,  Up: Marks
  1127.  
  1128. Altering Marks
  1129. --------------
  1130.  
  1131.    If you just want to set the position of a mark you can modify its
  1132. position component (*note Mark Components::.). Alternately the following
  1133. function may be used. When you need to set the file a mark points to
  1134. the only method is to use this function.
  1135.  
  1136.  - Function: set-mark MARK &optional POS BUFFER-OR-FILENAME
  1137.      This function sets either or both of the position and file
  1138.      components of the mark object MARK, then returns MARK.
  1139.  
  1140.      If POS is a position object the position component of MARK will be
  1141.      set to it (a copy of it actually).
  1142.  
  1143.      If the BUFFER-OR-FILENAME argument is non-`nil' the file component
  1144.      of MARK will be set. This argument can be a buffer object or a
  1145.      string naming a file. If a named file is already in a buffer that
  1146.      buffer will be used instead.
  1147.  
  1148.           (setq x (make-mark))
  1149.               => #<mark #<buffer programmer.texi> #<pos 46 6186>>
  1150.           (set-mark x (buffer-start))
  1151.               => #<mark #<buffer programmer.texi> #<pos 0 0>>
  1152.           (set-mark x nil "/tmp/foo")
  1153.               => #<mark "/tmp/foo" #<pos 0 0>>
  1154.  
  1155. 
  1156. File: jade.info,  Node: Moving to Marks,  Prev: Altering Marks,  Up: Marks
  1157.  
  1158. Moving to Marks
  1159. ---------------
  1160.  
  1161.  - Function: goto-mark MARK
  1162.      This function switches to the buffer containing MARK (if necessary)
  1163.      and then moves the cursor to the character that the mark points to.
  1164.  
  1165.      If the mark is not currently resident an attempt will be made to
  1166.      load the mark's file into a new buffer and use that.
  1167.  
  1168. 
  1169. File: jade.info,  Node: Glyph Tables,  Next: Input Events,  Prev: Marks,  Up: Programming Jade
  1170.  
  1171. Glyph Tables
  1172. ============
  1173.  
  1174.    A "glyph table" is a Lisp object used to define a mapping between
  1175. the characters which may occur in a buffer (anything with a numeric
  1176. value between 0 and 255 inclusive) and the sequences of glyphs which are
  1177. drawn into a window to represent these characters.
  1178.  
  1179.    A "glyph" is a image which, when rendered into the display, takes up
  1180. one character position. Each character in a buffer is rendered as a
  1181. sequence of 1 or more glyphs.
  1182.  
  1183.  - Function: glyph-table-p OBJECT
  1184.      This function returns `t' when its argument is a glyph table.
  1185.  
  1186. * Menu:
  1187.  
  1188. * Glyph Table Basics::          How a glyph table defines mappings
  1189. * Glyph Positions::             The position of a character and its
  1190.                                   glyph sequence may be different
  1191. * Creating Glyph Tables::       Making new glyph tables
  1192. * Buffer Glyph Tables::         Each buffer may use a separate glyph
  1193.                                 table for its display
  1194.  
  1195. 
  1196. File: jade.info,  Node: Glyph Table Basics,  Next: Glyph Positions,  Up: Glyph Tables
  1197.  
  1198. Glyph Table Basics
  1199. ------------------
  1200.  
  1201.    A glyph table is basically an array that has 256 elements; each
  1202. element represents one character and contains between zero and four
  1203. glyphs -- the glyphs which will be printed for the character.
  1204.  
  1205.    A special case exists for the tab character; when an element in the
  1206. table contains zero glyphs, enough spaces will be printed to fill in to
  1207. the next tab stop.
  1208.  
  1209.  - Function: get-glyph GLYPH-TABLE CHARACTER
  1210.      This function returns a string containing the glyphs in the
  1211.      element of the glyph table GLYPH-TABLE for the character CHARACTER.
  1212.  
  1213.           (get-glyph (default-glyph-table) ?a)
  1214.               => "a"
  1215.           
  1216.           (get-glyph (default-glyph-table) ?\t)
  1217.               => ""        ;TAB is special
  1218.           
  1219.           (get-glyph (default-glyph-table) ?\000)
  1220.               => "^@"      ;the NUL character
  1221.  
  1222.  - Function: set-glyph GLYPH-TABLE CHARACTER GLYPH-STRING
  1223.      This function sets the sequence of glyphs used to render the
  1224.      character CHARACTER in the glyph table GLYPH-TABLE to the
  1225.      characters in the string GLYPH-STRING.
  1226.  
  1227.      An error is signalled if there are more than four characters in
  1228.      GLYPH-STRING.
  1229.  
  1230.      All buffers which use GLYPH-TABLE for their rendering will be
  1231.      totally redrawn at the next redisplay.
  1232.  
  1233. 
  1234. File: jade.info,  Node: Glyph Positions,  Next: Creating Glyph Tables,  Prev: Glyph Table Basics,  Up: Glyph Tables
  1235.  
  1236. Glyph Positions
  1237. ---------------
  1238.  
  1239.    Position objects are usually used to refer to the position of a
  1240. character in a buffer, this position (sometimes called the "character
  1241. position" may not be the same as the position of the sequence of glyphs
  1242. printed to represent the character. When a position object is used to
  1243. refer to the position of a glyph it is called a "glyph position".
  1244.  
  1245.    For example, consider a line in a buffer containing the string
  1246. `a\tb' (where `\t' represents a tab character). When this is rendered
  1247. in a buffer the glyphs which will actually be drawn are,
  1248.  
  1249.      a       b
  1250.  
  1251. That is, an `a' glyph, followed by seven (assuming `tab-size' is set to
  1252. 8) ` ' glyphs, and lastly a `b' glyph.
  1253.  
  1254.    The character position of the `b' character in the buffer is `#<pos
  1255. 2 LINE>', where LINE is the line's number.
  1256.  
  1257.    Now the confusing bit: the *glyph* position of the `b' *glyph* is
  1258. `#<pos 8 LINE>' since it is actually the ninth glyph to be drawn.
  1259.  
  1260.    The good news is that most of the time you can forget about glyph
  1261. positions, they only need to be considered when you're thinking about
  1262. how the buffer will look when rendered in the window. For example, Lisp
  1263. programs which indent source code will definitely need to use glyph
  1264. positions.
  1265.  
  1266.    Two functions are provided for converting between character and glyph
  1267. positions and vice versa.
  1268.  
  1269.  - Function: char-to-glyph-pos &optional POS BUFFER
  1270.      Return a new position object containing the glyph position of the
  1271.      character at character position POS (or the cursor position) in the
  1272.      specified buffer.
  1273.  
  1274.  - Function: glyph-to-char-pos POS &optional BUFFER
  1275.      This function returns a new position object containing the
  1276.      character position of the glyph printed at glyph position POS in
  1277.      the specified buffer.
  1278.  
  1279.      If the glyph position POS is not the position of the first in a
  1280.      sequence of glyphs representing a single character the position of
  1281.      the next character will be returned.
  1282.  
  1283. 
  1284. File: jade.info,  Node: Creating Glyph Tables,  Next: Buffer Glyph Tables,  Prev: Glyph Positions,  Up: Glyph Tables
  1285.  
  1286. Creating Glyph Tables
  1287. ---------------------
  1288.  
  1289.  - Function: make-glyph-table SOURCE
  1290.      This function creates a new glyph table, containing glyph sequences
  1291.      defined by the SOURCE argument.
  1292.  
  1293.      If SOURCE is a glyph table it will be copied, if it's a buffer
  1294.      that buffer's glyph table will be copied or if SOURCE is `nil' a
  1295.      copy of the default glyph table will be made.
  1296.  
  1297. 
  1298. File: jade.info,  Node: Buffer Glyph Tables,  Prev: Creating Glyph Tables,  Up: Glyph Tables
  1299.  
  1300. Buffer Glyph Tables
  1301. -------------------
  1302.  
  1303.    Each buffer may define its own glyph table that will be used to
  1304. provide the character-to-glyph mappings for that buffer.
  1305.  
  1306.  - Function: buffer-glyph-table &optional BUFFER
  1307.      Returns the glyph table installed in the buffer.
  1308.  
  1309.  - Function: set-buffer-glyph-table GLYPH-TABLE &optional BUFFER
  1310.      Sets the glyph table being used in the buffer to GLYPH-TABLE.
  1311.  
  1312.    By default, each buffer uses the "default glyph table". This is a
  1313. glyph table set up when the editor initialise itself. The mappings it
  1314. provides are very generic, for more details see *Note Character
  1315. Images::.
  1316.  
  1317.  - Function: default-glyph-table
  1318.      This function returns the default glyph table.
  1319.  
  1320.    Redefining some of the mappings in the default glyph table is an easy
  1321. way to affect rendering operations, for example if I want the UK pound
  1322. sign character (ASCII value is octal 243) to be printed as itself and
  1323. not the usual escape sequence I can do the following,
  1324.  
  1325.      (set-glyph (default-glyph-table) ?243 "\243")
  1326.  
  1327. 
  1328. File: jade.info,  Node: Input Events,  Next: Keymaps,  Prev: Glyph Tables,  Up: Programming Jade
  1329.  
  1330. Input Events
  1331. ============
  1332.  
  1333.    An "input event" is a Lisp object representing an action initiated
  1334. by the user, i.e. a key press, pressing a mouse button and similar
  1335. things.
  1336.  
  1337.    Note that input events are often referred to as key presses, this
  1338. isn't really accurate but since most input events are key presses the
  1339. term sort of stuck. Anyway, wherever the phrase `key press' occurs in
  1340. this manual it could be replaced by `input event'.
  1341.  
  1342.    Each input event is represented by a cons cell (*note Cons Cells::.)
  1343. containing two integers, these integers encode the actual input event.
  1344. The encoding is opaque; the only way to access an event meaningfully is
  1345. via the functions provided.
  1346.  
  1347.  - Function: eventp OBJECT
  1348.      This function returns `t' if its argument is an input event.
  1349.  
  1350.    Each event has a textual name, for the actual format of these names
  1351. see *Note Key Names::.
  1352.  
  1353.    Functions are available to convert between the name of an event and
  1354. the actual event itself, and vice versa.
  1355.  
  1356.  - Function: lookup-event EVENT-NAME
  1357.      Create and return a new input event whose name is EVENT-NAME.
  1358.  
  1359.           (lookup-event "Ctrl-x")
  1360.               => (120 . 9)
  1361.           
  1362.           (lookup-event "Ctrl-Meta-LMB-Click1")
  1363.               => (1 . 58)
  1364.  
  1365.  - Function: event-name EVENT
  1366.      This function returns a string naming the input event EVENT.
  1367.  
  1368.           (event-name (lookup-event "Ctrl-x"))
  1369.               => "Ctrl-x"
  1370.  
  1371.